<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
	<script src="https://code.highcharts.com/highcharts.js"></script>
	<title>小型超市管理系统</title>
	<style>
		body {
			background-color: #F5F5F5;
		}
		.container {
			display: flex;
			height: 100vh;
		}
		.sidebar {
			flex-basis: 200px;
            background-color: #D3D3D3;
			color: #000;
			padding: 20px;
			display: flex;
			flex-direction: column;
			justify-content: space-between;
		}
		.sidebar h1 {
			margin: 0;
			font-size: 1.5rem;
			text-align: center;
		}
		.sidebar ul {
			list-style: none;
			margin: 20px 0;
			padding: 0;
			flex-grow: 1;
			display: flex;
			flex-direction: column;
			justify-content: space-around;
		}
		.sidebar li {
			margin-bottom: 10px;
			font-size: 1.5rem; /* 修改字体大小 */
		}
		.sidebar li a {
			color: #000;
			text-decoration: none;
		}
		.sidebar li.active {
			font-weight: bold;
		}
		.main {
			flex-grow: 1;
			padding: 20px;
		}

      /* 样式表 */
      table {
        border-collapse: collapse;
        width: 100%;
        margin-bottom: 20px;
      }
      th, td {
        text-align: left;
        padding: 8px;
        border: 1px solid #ddd;
      }
      th {
        background-color: #f2f2f2;
      }
      .product-row {
        margin-bottom: 10px;
        padding: 10px;
        border: 1px solid #ddd;
      }
      .product-row h4 {
        margin-top: 0;
        margin-bottom: 5px;
      }
      .product-row p {
        margin-top: 0;
        margin-bottom: 5px;
        font-size: 14px;
      }
      .product-row .price {
        font-weight: bold;
        font-size: 16px;
      }
      /* 分界线 */
      .separator {
        border-top: 1px solid #ddd;
        margin-top: 20px;
        margin-bottom: 20px;
      }
	</style>
</head>
<body>
	<div class="container">
		<div class="sidebar">
			<h1>小型超市管理系统</h1>
			<ul>
                {% block sidebar %}
<li><a href="{{url_for('products.products')}}">商品管理</a></li>
<li><a href="{{url_for('member.members')}}">会员管理</a></li>
<li><a href="{{url_for('sale.saleorders')}}">销售管理</a></li>
<li><a href="{{url_for('purchase_orders.purchase_orders')}}">采购管理</a></li>
<li><a href="{{url_for('sale.display_analysis')}}">统计分析</a></li>
                {% endblock %}
			</ul>
		</div>
		<div class="main">
			<!-- 右侧内容部分 -->
            {% block main %}
            
            {% endblock %}
		</div>
	</div>

    	<script>
		// 获取当前页面的 URL
		var currentUrl = window.location.href;

		// 获取菜单项的链接并逐一进行判断
		var menuLinks = document.querySelectorAll('.sidebar ul li a');
		for (var i = 0; i < menuLinks.length; i++) {
			if (menuLinks[i].href === currentUrl) {
				menuLinks[i].parentNode.classList.add('active');
				break;
			}
		}
	</script>
</body>
</html>
